#include "blockmatrix.h"

void BlockMatrix::insert(int i, int j){
    if(i>h_matrix || j>w_matrix)
        printf("%d %d - %d %d", i,j ,h_matrix, h_matrix);
    else
        matrix[i*h_matrix+j] = Block(IN_RADIUS, OUT_RADIUS, OPENING_ANGLE, NUM_POINTS, DEFAULT_POINT, i,j);
}

void BlockMatrix::remove(int i, int j){
    matrix[i*h_matrix+j] = Block();
}

Block BlockMatrix::get(int i, int j){
    return matrix[i*h_matrix+j];
}

void BlockMatrix::drawMatrix(){
    for(int i=0; i<h_matrix*w_matrix; i++){
        if(!matrix[i].isEmpty()){
            matrix[i].drawBlock();
        }
    }
}
